package com.mvc.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.mvc.config.ActionForward;
import com.mvc.form.ActionForm;

public abstract class Action {
	public abstract String execute(HttpServletRequest req, HttpServletResponse resp, ActionForm form);
	
	public static Action getAction(String actionName){
		Action action = null;
		try {
			Class clazz = Class.forName(actionName);
			action = (Action) clazz.newInstance();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		}
		return action;
	}
}
